<template>
	<view>
	<div id="fill_data">
	    <div class="fill">
	        <div class="am-form-group">
				<form action="#" method="get" name="regForm">
				<input type="text" name="required" data-required="请输入新手机号" class="mdn-input" v-model ="fd.phone" placeholder="请输入修改后的手机号"/>
				<div align="right" style="color: red;">{{msg}}</div>			
				</form>
			</div>
	    </div>
	</div>
	<div class="done" @click="submit()">保存</div>
	
		
	</view>
</template>

<script>
import config from '@/config'
	export default {
		data() {
			return {
				config,
				uni,
				fd:{
					phone:"",
				},
				msg:""
			}
		},
		methods: {
			submit: function() {
				console.log("进入submit函数");
				var that = this;
				uni.request({
					
					url: `${config.baseUrl}/changen/chphone?token=`+uni.getStorageSync('token'),
					method: 'POST',
					data: this.fd,
					success(r) {
						console.log("发送请求");
						if (r.data.succ) {
							console.log("保存成功")
							uni.navigateTo({
								url: 'user_data'
							})
						} else {
							that.msg = "请正确输入手机号";
							console.log("发送失败");
						}
					}
				})
			}
		}
	}

</script>

<style>

</style>
